<template>
	<view class="content">
		<my-top-new :userName="userName" :topName="topName"></my-top-new>
		<view class="indexContent">
			<view style="margin-top:60rpx;font-size: 38rpx;" class="Teacher">
				<view v-for="(item,index) in indexArr" :key="index" style="text-align: center;">
					<view style="width: 200rpx;" @click="classIndexSkip(item)">
						<div style="margin: 20rpx;">
							<image :src="item.img" style="width: 130rpx;height: 130rpx;"></image>
							<view style="font-size: 15px;">{{item.indexName}}</view>
						</div>
					</view>
					<!-- <view v-if="item.indexName=='宿舍巡查'||item.indexName=='课间违纪巡查'||item.indexName=='报修登记'"
						class="indexTeacher" @click="classIndexSkip(item)">
						<view style="margin-left:60rpx;line-height: 280rpx;">
							{{item.indexName}}
						</view>
					</view>

					<view v-else-if="item.indexName=='入校/早操巡查'||item.indexName=='午休巡查'" class="indexDormitory"
						@click="classIndexSkip(item)">
						<view style="margin-left:60rpx;line-height: 280rpx;">
							{{item.indexName}}
						</view>
					</view>

					<view v-else class="indexHealth" @click="classIndexSkip(item)">
						<view style="margin-left:60rpx;line-height: 280rpx;">
							{{item.indexName}}
						</view>
					</view> -->

				</view>
				<view class="attdenanceSty" @click="goBackIndex()">
					<view style="text-align: center;width:605rpx;font-size: 38rpx;">返回管理界面</view>
				</view>
			</view>
			<!-- <view class="logoSty"></view> -->
		</view>
		<!-- <my-bottom :bottomArr="attendanceArr"></my-bottom> -->
		<!-- <bottom-com :bottomArr="attendanceArr"></bottom-com> -->
	</view>
</template>

<script>
	import topCom from '@/pages/component/topCom.vue'
	import bottomCom from '@/pages/component/bottom.vue'
	export default {
		data() {
			return {
				src: this.$src,
				userName: '',
				topName: '值班首页',
				showFresh: 'true',
				ss: '退出',
				indexArr: [{
					icon: '',
					indexName: '宿舍巡查',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/dor.png',
				}, {
					icon: '',
					indexName: '晨检巡查',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/chenji.png',
				}, {
					icon: '',
					indexName: '课堂巡查',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/kets.png',
				}, {
					icon: '',
					indexName: '课间巡查',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/kejs.png',
				}, {
					icon: '',
					indexName: '午休巡查',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/wuxiu.png',
				}, {
					icon: '',
					indexName: '晚自习巡查',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/wanzx.png',
				}, {
					icon: '',
					indexName: '报修登记',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/baox.png',
				}, {
					icon: '',
					indexName: '早操登记',
					img: 'https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/wuxiu.png',
				}],
				attendanceArr: [{
						name: 'home',
						icon: 'iconfont icon-yonghutongji',
						text: "考勤",
						path: '/pages_main/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
					},
					{
						name: 'atttendance',
						icon: 'iconfont icon-bi',
						text: "统计",
						path: '/pages_main/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
					},
					{
						name: 'maintenance',
						icon: 'iconfont icon-shezhi',
						text: "设置",
						path: '/pages_main/dutyCheckWorkAttendance/dutyIndex/dutyIndex'
					}
				]
			}
		},
		components: {
			topCom,
			bottomCom
		},

		mounted() {

			//  uni.request({
			//  	url:'http://192.168.200.213:9005',
			// method:'post',
			// dataType:'JSON',
			// success() {

			// }
			//  })
		},
		onShow() {
			
			var that = this
			uni.getStorage({
				key: "userInfo",
				success: (res) => {
					that.userName = this.ss + res.data
					console.log(res, 666)
				}
			})
			if (this.showFresh) {
				// location.reload()
				this.showFresh = false
				return;
			}
			

		},
		methods: {
			line(res) {
				var strs = res;
				var arr = strs.split('');
				var str = ''
				for (let i = 0, s; s = arr[i++];) {
					str += s;
					if (!(i % 4)) str += '<br />';
				}
			},
			goBackIndex() {
				uni.navigateTo({
					url: '/pages/classManagement/classManagementIndex'
				})
			},
			classIndexSkip(item) {
				if (item.indexName == '晨检巡查') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutySchoolList',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				} else if (item.indexName == '午休巡查') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutyMoonAttendanceStatus',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				} else if (item.indexName == '课堂巡查') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutyClassList',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				} else if (item.indexName == '课间巡查') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutyAfterClassList',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				} else if (item.indexName == '报修登记') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutyMaintenanceList',
						success: res => {},
						fail: () => {},
						complete: () => {}
					});
				} else if (item.indexName == '宿舍巡查') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutyDorList?buildingNo=畔湖苑&type=卫生'
					})
				} else if (item.indexName == '晚自习巡查') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutyAttendanceNightList'
					})
				} else if (item.indexName == '早操登记') {
					uni.navigateTo({
						url: '/pages_main/dutyCheckWorkAttendance/dutyMorningExercises'
					})
				}
			}
		}
	}
</script>

<style>
	.indexContent {
		height: 100%;
		/* height: 70vh; */
		/* position: relative; */
	}

	.logoSty {
		position: absolute;
		z-index: 999;
		bottom: 50rpx;
	}

	.Teacher {
		display: flex;
		/* 
		align-items: center;
		justify-content: center; */
		flex-wrap: wrap;
		margin: 60rpx;
	}

	.Teacher::after {
		content: '';
		width: 33%;
		height: 0;
		display: block;
	}

	.indexTeacher {
		margin: auto;
		margin-top: 40rpx;
		width: 280rpx;
		height: 280rpx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-5.png);
		background-size: 100% 100%;
		color: white;
		font-size: 38rpx;
		border-radius: 50%;
		/* opacity: 0.8; */
	}

	.indexHealth {
		margin: auto;
		margin-top: 40rpx;
		width: 280rpx;
		height: 280rpx;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-4.png);
		background-size: 100% 100%;
		color: white;
		font-size: 38rpx;
		border-radius: 50%;
	}

	.indexDormitory {
		margin: auto;
		margin-top: 40rpx;
		width: 280rpx;
		height: 280rpx;
		display: flex;
		justify-content: space-between;
		background-image: url(https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/T-6.png);
		background-size: 100% 100%;
		color: white;
		font-size: 38rpx;
		border-radius: 50%;
	}

	s .content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
